#ifndef MENUMANAGER_H
#define MENUMANAGER_H

#include "main.h"
#include <iostream>
#include <list>
#include <string>

//forward declaration
class CMenuScreen;


class CMenuManager {
		int m_windowWidth;
		int m_windowHeight;
		std::list<std::string> m_topMenuItems;

		//space between window and menu items
		int m_spaceTopBottom;
		int m_menuItemHeight;
		int m_spaceBetweenItems;
		int m_numberTopMenuItems;

		//space in pixels between left
		//and right end of menu and window border
		int m_spaceLeftRight;

//		struct menuButton {
//			std::string text;
//			int order;
//			int followScreenID;
//		};



		//TODO: maximum array size
//		struct screen {
//			menuButton m_menuButton[10];
//			int m_numberButtons;
//		};

		//TODO: maximum array size
//		screen m_screen[5];

		int m_currentScreenNum;
		std::list<CMenuScreen*> m_menuScreenList;
		
	public:
		//ctor, dtor
		CMenuManager(int,int);
		~CMenuManager();

		//functions
		/** uses tinyXML to read the menu structure.
		 *  it cycles through the "Screen" elements
		 *  and saves it in m_menuScreenList.
		 *  then it calls the addButton function of the current
		 *  screen object. 
		 *  \param filename filename of the XML file to open
		 */
		void createMenu(char *filename);
		void printTopMenuItems(void);

		void updateWindowSize(int width, int height);

		void setCurrentScreen(int screenNum) {m_currentScreenNum=screenNum;}
		
		/** draws an almost black quad on the screen which
		 * with an alpha value so the background is dimmed.
		 * then it searches for the requested screen (number).
		 * afterwards it cycles through the menuButtonList of
		 * the requested screen and draws them on the real screen.
		 * it also calculates the right position of the button text
		 * and draws is accordingly.
		 *
		 * \param screenNum number of the screen to display
		 */
		void drawScreenItems(int screenNum);
		void drawScreenItems();

		
		CMenuScreen* getCurrentScreen(void);

		//variables
};


#endif
